package com.blog.cloud.oss.properties;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.convert.DurationUnit;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.validation.annotation.Validated;

import java.time.Duration;
import java.time.temporal.ChronoUnit;

@Getter
@Setter
//@Validated
@ConfigurationProperties(prefix = "aliyun.oss")
public class AliyunOssProperties {

    private String accessId;
    private String secretKey;
    private String endpoint;
    private String bucket;

    private Long expireTime;

    // 默认单位是毫秒，可以使用@DurationUnit 覆盖，现在可以用 s 表示秒
    @DurationUnit(ChronoUnit.SECONDS)
    private Duration sessionTimeout = Duration.ofSeconds(30);
}
